﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ComeSeeThis_MVC2.Models.RoleFormView>" %>
<%@ Import Namespace="ComeSeeThis_MVC2.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	RoleEdit
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Edit Role</h2>

        <table>
        <tr>
            <td valign="top">
                <% using (Html.BeginForm())
                   {%>
                <% Html.RenderPartial("RoleForm"); %>
                <% } %>
            </td>
            <td valign="top">
                <fieldset>
                    <legend>Assign Operation:</legend>
                    <% using (Ajax.BeginForm("SubmitOperation", new AjaxOptions { UpdateTargetId = "SubmittedOperations" }))
                       { %>
                    <input type="hidden" id="roleId" name="roleId" value="<%: Model.RoleId%>" />
                    <select id="operationId" name="operationId">
                        <% foreach (var operation in Model.Operations)
                           {%>
                        <option value="<%: operation.OperationId%>"><%: operation.Name%></option>
                        <% } %>
                        <% } %>
                    </select>
                    <input type="submit" value="Add Operation" />
                </fieldset>
                <div id="SubmittedOperations">
                    <% Html.RenderPartial("OperationList", new OperationForm(Model.RoleId));%>
                </div>
            </td>
        </tr>
    </table>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="BodyTagContent" runat="server">
</asp:Content>
